package com.erhairent.tools;

import java.util.InputMismatchException;
import java.util.Scanner;

public class InputTools {
	public static Scanner sc = new Scanner(System.in);

	public static String next() {
		return sc.next();
	}

	public static int nextInt() {
		while (true) {
			try {
				return sc.nextInt();
			} catch (InputMismatchException e) {
				System.out.println("输入有误,请重新输入");
				InputTools.sc.next();
				continue;
			}
		}
	}

	public static double nextDouble() {
		while (true) {
			try {
				return sc.nextDouble();
			} catch (InputMismatchException e) {
				System.out.println("输入有误,请重新输入");
				InputTools.sc.next();
				continue;
			}
		}
	}

	public static long nextLong() {
		while (true) {
			try {
				return sc.nextLong();
			} catch (InputMismatchException e) {
				System.out.println("输入有误,请重新输入");
				InputTools.sc.next();
				continue;
			}
		}
	}
}
